home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 352_01.zip / VECSHOW.CPP < prev    next >
C/C++ Source or Header  |  1993-04-10  |  868b  |  40 lines

  1. // VECSHOW.CPP
  2. //        show values of a Vector in an on-screen window
  3. //        used principally for debugging.
  4. //
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include "wtwg.h"
  8. #include "dblib.h"
  9. #include "vector.h"
  10.  
  11. void Vector::show(char *title )
  12.     {
  13.     /* room for 100 numbers, 5 per row, 20 rows */
  14.     #define NUM_PER_ROW    5
  15.     #define BYTES_PER_NUM    9
  16.     #define ROWLEN          ( NUM_PER_ROW*(1+BYTES_PER_NUM) + 5 )
  17.  
  18.     int ndata = n;
  19.  
  20.     wopen ( 2,2, ROWLEN,20, (LIGHTBLUE<<4),SINGLE_BORDER,(LIGHTBLUE<<4),
  21.              WSAVE2RAM );
  22.     wtitle (title);
  23.  
  24.     for ( int i=0; ( i<= 100 && i<= ndata ); ++i)
  25.         {
  26.         wprintf ("%.7f ", v[i]);
  27.         if ( i % NUM_PER_ROW )
  28.             {
  29.             wputc ('\n');
  30.             }
  31.         }
  32.     wgoto ( 5, 19 );        // last row
  33.     wputs ("Press any key...");
  34.  
  35.     wgetc();
  36.     wclose();
  37.  
  38.     return;         // Vector::show()
  39.     }
  40. //---------------- end of VECSHOW.CPP -----------------------